/*
 * Created on Nov 23, 2004
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.hermeneute.fsa.parser;

import java.io.FileReader;
import java.io.IOException;
import java.io.StringReader;
import org.eclipse.core.runtime.IProgressMonitor;
import antlr.RecognitionException;
import antlr.TokenStreamException;


/**
 * @author mauceri
 *
 * Window - Preferences - Java - Code Style - Code Templates
 */

public class FSTBuilder {
	/**
	 * 
	 */
	public FSTBuilder (){
		super();
	}

	static public void stringBuilder (String definition) {
		try {
			StringReader srtr = new StringReader(definition);
			System.out.println("Good");
			FSTLexer lexer = new FSTLexer(srtr);	
			System.out.println("Good");
			FSTParser parser = new FSTParser(lexer);
			parser.file();
			System.out.println("Good");
		}catch (Exception x){
			x.printStackTrace();
		}		
	}
	static public void fileBuilder (String file,IProgressMonitor monitor) throws Exception, TokenStreamException, RecognitionException, IOException {
			FileReader fr = new FileReader(file);
			System.out.println("Good");
			FSTLexer lexer = new FSTLexer(fr);	
			System.out.println("Good");
			FSTParser parser = new FSTParser(lexer);
			parser.setPM(monitor);
			parser.file();
			System.out.println("Good");
	}
}
